home *** CD-ROM | disk | FTP | other *** search
/ Adobe Digital Video Collection / Digital Video Collection CD.iso / After Effects 5.5 / MMScriptEng.Cab / F115580_layeraudioremap.mm < prev    next >
Encoding:
Text File  |  2001-12-07  |  999 b   |  27 lines

  1. // Layer audio to time remap - Version 1.0
  2.  
  3. // This Program Sets the value of the first set of popups
  4. // to the audio level of the layer in popup 2, scaled to lie within the range [min, max].
  5. // It only applies keyframes during the duration of the audio layer.
  6.  
  7. // LAYER                                        PROPERTY                    CHANNEL
  8. // ------                                        ----------                --------
  9. // 1: Layer to copy audio amplitude into        property to vary            channel of property
  10. // 2: Layer with audio                            doesn't matter                doesn't matter
  11.  
  12. max = 0.02;        // change this to the maximum value
  13. min = -0.02;            // change this to the minimum value
  14.  
  15. if (time() == start_time) {    //initialization
  16.     audio_in    = layer_time_bounds(pop_layer(2))[0] ;
  17.     audio_out    = layer_time_bounds(pop_layer(2))[1] ;
  18. }
  19.  
  20. if ( (time() >= audio_in) && (time() <= audio_out) ) {
  21.  
  22.     value(pop_layer(1), pop_property(1)) [pop_channel(1)] = 
  23.          min + layer_audio_amplitude(pop_layer(2)) * (max - min) +
  24.         value(pop_layer(1), pop_property(1)) [pop_channel(1)];
  25.  
  26. }
  27.